<template>
	<view class="reward">
		<view class="reward_one" v-for="(item,index) in jiangliArray" :key="index">
			<view class="reward_one_title">
				{{item.key_text}}
			</view>
			<view class="reward_one_number">
				{{item.value}}kdj
			</view>
			<block v-if="item.is_sign==1">
				<view class="reward_button" style="background-color: #cccccc;">
					已领取
				</view>
			</block>
			<block v-else>
				<view class="reward_button" style="background-color: #cccccc;" v-if="item.is_day==2">
					已过期
				</view>
				<view class="reward_button" style="background-color: #cccccc;" v-if="item.is_day==0">
					领取
				</view>
				<view class="reward_button" @click="goLingqu" v-if="item.is_day==1&&item.is_sign==0">
					领取
				</view>
			</block>
		</view>
	</view>
</template>

<script>
	export default {
		data(){
			return {
				jiangliArray:[],//奖励数组
			}
		},
		onLoad() {
			this.getJiangli()
		},
		methods:{
			async getJiangli(){
				await uni.request({
					url:"/wanlshop/Signin/index",
					method:"POST",
					data:{},
					success: (res) => {
						this.jiangliArray=res.data
						console.log(res,'899999999999999')
					}
				})
			},
			async goLingqu(item){
				await uni.request({
					url:"/wanlshop/Signin/dosign",
					method:"POST",
					data:{},
					success: () => {
					   	this.$wanlshop.msg('领取成功')
						this.getJiangli()
					}
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.reward{
		width: 100%;
		background-color: #ffffff;
		box-sizing: border-box;
		padding: 20rpx 24rpx 0;
		.reward_one{
			width: 100%;
			height: 100rpx;
			border-bottom: 1rpx solid #f7f7f7;
			display: flex;
			align-items: center;
			justify-content: space-between;
			.reward_one_title{
				font-size: 30rpx;
				color: #333333;
				font-weight: 800;
			}
			.reward_one_number{
				font-size: 28rpx;
				color: #333333;
				font-weight: 500;
			}
			.reward_button{
				width: 140rpx;
				height: 60rpx;
				background-color: #fe6600;
				border-radius: 40rpx;
				line-height: 60rpx;
				text-align: center;
				font-size: 30rpx;
				color: #ffffff;
			}
		}
	}
</style>